package cn.planewar;

import javax.swing.ImageIcon;
import java.util.Random;

public class Bee extends SkyObject implements EnemyFire,EnemyLife{
    private int xspeed;
    private int yspeed;
    private int awardType;
    public Bee(){
        super(60,51);
        Random rand = new Random();
        if (rand.nextBoolean()){
            xspeed = -1;
        } else {
            xspeed = 1;
        }
        yspeed = 1;
        awardType =rand.nextInt(2);
    }
    public void step(){

        if (this.getX()+this.getWidth()>=World.WIDTH || this.getX()<=0) {
            xspeed *= -1;
        }
        this.setY(getY()+yspeed);
        this.setX(getX()+xspeed);
    }
    public ImageIcon getImage(){
        if (getObjstate()==0){
            return Image.bee0;
        } else {
            return Image.bee1;
        }
    }
    public int getAwardType(){
        return awardType;
    }
    public int getFire(){
        return 1;
    }
    public int getLife(){
        return 1;
    }
}
